﻿using BSKTV.Model;
using BSKTV.Server.View.Page;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using System.Reflection;
using Wpf.Ui.Common;
using Wpf.Ui.Controls.Navigation;

namespace BSKTV.Server.ViewModel
{
    public class MainViewModel : ObservableObject
    {
        private string _title;

        public MainViewModel()
        {
            Init();

            InitNavigation();
        }

        public string Title { get => _title; set => SetProperty(ref _title, value); }

        private void Init()
        {
            Title = GetAppTitle();
        }

        private string GetAppTitle()
        {
            return $"{Constant.AppName} {Constant.AppVersion}";
        }

        #region 导航

        private ObservableCollection<object> _menuItems;
        public ObservableCollection<object> MenuItemList
        {
            get => _menuItems;
            set => SetProperty(ref _menuItems, value);
        }

        private void InitNavigation()
        {
            _menuItems = new ObservableCollection<object>();

            var home = new NavigationViewItem("Home", SymbolRegular.Home24, typeof(HomePage));
            home.MinWidth = 100;
            home.MaxWidth = 200;

            _menuItems.Add(home);
        }

        #endregion
    }
}
